
import 'package:flutter/material.dart';
import 'package:flutterdemo/service/http_request.dart';


void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      // 启动要显示的界面
      home: HomeContent(),
    );
  }
}

class HomeContent extends StatefulWidget {
  @override
  _HomeContentState createState() => _HomeContentState();
}

class _HomeContentState extends State<HomeContent> {

  void dioNetwork() {
    HttpRequest.get('http://rest.apizza.net/mock/3bb78bf66bbd102a95221370ba9ddc2f/test', params: {'name': 'wc'}).then((value) {
      print('结果：$value');
    }).catchError((error) {
      print('报错信息：$error');
    });
  }

  @override
  void initState() {
    // TODO: implement initState
    super.initState();

    dioNetwork();
  }
  @override
  Widget build(BuildContext context) {
    return Container(
      color: Colors.brown,
    );
  }
}
